package org.looop.studio.bean.domain;

import java.util.HashMap;
import java.util.Map;

import org.looop.studio.bean.builder.BeanBuilder;
import org.looop.studio.bean.builder.impl.SetterBuilder;
import org.looop.studio.bean.desc.ValueDesc;

public class BeanDefinition {
	private String id;
	private String clazz;
	private String scope;
	private BeanBuilder beanBuilder = new SetterBuilder();
	private Map<String, ValueDesc> properties;
	private ValueDesc[] constructorArgs;
	private String factoryClass;
	private String factoryMethod;

	public String getFactoryClass() {
		return factoryClass;
	}

	public void setFactoryClass(String factoryClass) {
		this.factoryClass = factoryClass;
	}

	public String getFactoryMethod() {
		return factoryMethod;
	}

	public void setFactoryMethod(String factoryMethod) {
		this.factoryMethod = factoryMethod;
	}

	public ValueDesc[] getConstructorArgs() {
		return constructorArgs;
	}

	public void setConstructorArgs(ValueDesc[] constructorArgs) {
		this.constructorArgs = constructorArgs;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getClazz() {
		return clazz;
	}

	public void setClazz(String clazz) {
		this.clazz = clazz;
	}


	public BeanDefinition(String id, String clazz, String scope) {
		super();
		this.id = id;
		this.clazz = clazz;
		this.scope = scope;
	}

	public BeanDefinition(String clazz, String scope) {
		super();
		this.clazz = clazz;
		this.scope = scope;
	}
	
	public BeanDefinition(String clazz) {
		super();
		this.clazz = clazz;
	}

	public Map<String, ValueDesc> getProperties() {
		return properties;
	}

	public void setProperties(Map<String, ValueDesc> properties) {
		this.properties = properties;
	}
	
	public void addProperty(String name, ValueDesc valueDesc) {
		if (properties == null) {
			properties = new HashMap<String, ValueDesc>();
		}
		properties.put(name, valueDesc);
	}

	public String getScope() {
		return scope;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}

	public BeanBuilder getBeanBuilder() {
		return beanBuilder;
	}

	public void setBeanBuilder(BeanBuilder beanBuilder) {
		this.beanBuilder = beanBuilder;
	}



}